package com.dgshanger.sanhxiaofeisc.ui.login

import com.dgshanger.sanhxiaofeisc.R
import com.dgshanger.sanhxiaofeisc.mvp.contract.ForgetPwContract
import com.xx.baseuilibrary.mvp.BaseMvpActivity
import com.xxl.sodmall.mvp.presenter.ForgetPwPresenter
import kotlinx.android.synthetic.main.activity_forget_pw.*

/**
 * ForgetPwActivity
 * 沉迷学习不能自拔
 * Describe：忘记密码页面
 * Created by 雷小星🍀 on 2018/2/2 11:36.
 */
class ForgetPwActivity : BaseMvpActivity<ForgetPwContract.Model, ForgetPwContract.View, ForgetPwPresenter>(), ForgetPwContract.View {

    override fun changeSuccess() {
        finish()
    }

    override fun createPresenter(): ForgetPwPresenter = ForgetPwPresenter()

    override fun getPhone(): String = et_phone.text.toString().trim()

    override fun getVCode(): String = et_code.text.toString().trim()

    override fun getNewPw(): String = et_password.text.toString().trim()

    override fun getSurePw(): String = et_newPassword.text.toString().trim()

    override fun setSendBtnEnable(enable: Boolean) {
        tv_send_code.isEnabled = enable
    }

    override fun setSendBtnText(content: String?) {
        tv_send_code.text = content
    }

    override fun getActivityLayoutId(): Int = R.layout.activity_forget_pw

    override fun initEvent() {
        tv_send_code.setOnClickListener {
            getPresenter().sendVCode()
        }
        btn_sure.setOnClickListener {
            getPresenter().changePw()
        }
    }

    override fun initData() {
    }
}